/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.comunicacion2.model.pathloss;

import com.comunicacion2.model.PathLossModel;

/**
 *
 * @author LangTecnologia
 */
public class SimplifiedPathLoss implements PathLossModel{

    private static final int C = 300;
    
   private final double constantFactorK;
   private final int powerTransmitter;
   private final double referenceDistance;
   private final double pathLossFunction;

   //Cambiar los parametros de entrada
   
   public SimplifiedPathLoss(double constantFactorK, int powerTransmitter, double referenceDistance, double pathLossFunction){
       this.constantFactorK = constantFactorK;
       this.powerTransmitter = powerTransmitter;
       this.referenceDistance = referenceDistance;
       this.pathLossFunction = pathLossFunction;
   }

    public int calculateIntensity(double distance) {
        
        double intensity = powerTransmitter * constantFactorK * Math.pow((referenceDistance /distance), pathLossFunction);
        
        Double intensityDb = 10 * Math.log10(intensity);
        
        return intensityDb.intValue();
    }
}
